package yanyan.com.tochar;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import com.alibaba.fastjson.JSON;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.IOException;

import yanyan.com.tochar.beans.AllInfo;
import yanyan.com.tochar.utils.HttpUtil;

import static org.junit.Assert.*;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
    @Test
    public void useAppContext() {
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getTargetContext();

        assertEquals("yanyan.com.tochar", appContext.getPackageName());
    }

    @Test
    public void hhh(){
        try {
            Document document=Jsoup.connect("https://blog.csdn.net/qq_36880660/article/details/88044542").get();
            Element title = document.select("title").first();

            String s = document.toString();
            System.out.println(s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void tette(){
        String  res="{\"appInfo\":{\"ispopup\":\"N\",\"notice\":\"111\",\"updateNotic\":\"软件有新版本2.1--------             增加短视频解析功能,优化软件的一些功能\",\"updateUrl\":\"https://www.coolapk.com/apk/yanyan.com.tochar\",\"versionNm\":\"2.1\",\"version\":6,\"updateTm\":\"2020-01-14T21:59:47.000+0000\",\"newTm\":\"2020-01-14T21:59:44.000+0000\",\"otherUrl\":\"http://www.qjiexi.com/\"},\"bannerInfos\":[{\"id\":7,\"image\":\"https://goss3.veer.com/creative/vcg/veer/612/veer-132487283.jpg\",\"url\":\"https://goss3.veer.com/creative/vcg/veer/612/veer-132487283.jpg\",\"userQQ\":\"222\",\"expireTm\":\"2021-03-03T21:46:51.000+0000\",\"newTm\":\"2020-01-03T21:47:04.000+0000\",\"updateTm\":\"2020-01-03T21:47:11.000+0000\",\"eff\":\"Y\",\"act\":\"GifActivity\"},{\"id\":8,\"image\":\"https://goss1.veer.com/creative/vcg/veer/612/veer-135690447.jpg\",\"url\":\"https://goss1.veer.com/creative/vcg/veer/612/veer-135690447.jpg\",\"userQQ\":\"2222\",\"expireTm\":\"2020-02-29T21:47:44.000+0000\",\"newTm\":\"2020-01-03T21:47:51.000+0000\",\"updateTm\":\"2020-01-03T21:47:54.000+0000\",\"eff\":\"Y\",\"act\":\"GifToCharActivity\"},{\"id\":10,\"image\":\"https://goss1.veer.com/creative/vcg/veer/612/veer-130163414.jpg\",\"url\":\"https://goss1.veer.com/creative/vcg/veer/612/veer-130163414.jpg\",\"userQQ\":\"2222\",\"expireTm\":\"2020-02-29T21:49:14.000+0000\",\"newTm\":\"2020-01-03T21:50:05.000+0000\",\"updateTm\":\"2020-01-03T21:50:08.000+0000\",\"eff\":\"Y\",\"act\":\"MoreActivity\"},{\"id\":11,\"image\":\"https://images.smcdn.cn/ctm1aVjFdr0fjA5U/20200108132859.png!thumbnail\",\"url\":\"https://images.smcdn.cn/ctm1aVjFdr0fjA5U/20200108132859.png!thumbnail\",\"userQQ\":\"11111\",\"expireTm\":\"2020-11-05T19:39:13.000+0000\",\"newTm\":\"2020-01-08T19:39:21.000+0000\",\"updateTm\":\"2020-01-08T19:39:24.000+0000\",\"eff\":\"Y\",\"act\":\"OneActivity\"}],\"webInfos\":[{\"id\":1,\"url\":\"www.baidu.com\",\"isValid\":\"Y\",\"tilte\":null,\"notice\":\"3455\"},{\"id\":2,\"url\":\"http://www.qjiexi.com/\",\"isValid\":\"Y\",\"tilte\":null,\"notice\":\"建议:解析后复制链接到浏览器下载\"}]}";
        AllInfo allInfo = JSON.parseObject(res, AllInfo.class);
        System.out.println("res");
    }
}
